#{extends 'common/base.html' /}
<script>
	$(function() {
		$('#useClick').datepicker().on('changeDate.datepicker.amui',
				function(event) {
					$('#useDateStr').text($('#useClick').data('date'));
					$(this).datepicker('close');
				});
		$("#search_sub").click(function(){
			$("#date").val($("#useDateStr").html());
			$("#myform").submit();
		})
	});
</script>
<!-- content start -->
<div class="admin-content">
	<div class="am-cf am-padding">
		<div class="am-fl am-cf">
			<strong class="am-text-primary am-text-lg">当前安全库存</strong> / <small>SafeInventory</small>
		</div>
	</div>
		<form class="am-form" id="myform" action="safeIndex" method="post">
		<div class="am-g">
			<div class="am-u-sm-12 am-u-md-3" style="width: 50%;">
				<div class="am-form-group">
						<button type="button" class="am-btn am-btn-default am-margin-right"
						id="useClick">统计日期</button>
					<span id="useDateStr">${date}</span> <input hidden name="date" id="date"> &nbsp;&nbsp;&nbsp;
					<button class="am-btn am-btn-default" id="search_sub" type="button">搜索</button>
				</div>
				</div>
				</div>
				</form>
	<div class="am-g">
		<div class="am-u-sm-12">
			<table class="am-table am-table-striped am-table-hover table-main">
				<thead>
					<tr>
						<th class="table-type">序号</th>
						<th class="table-type">规格</th>
						<th class="table-type">供应商</th>
						<th class="table-type">当前库存</th>
						<th class="table-type">安全库存</th>
						<th class="table-type">领用数量</th>
						<th class="table-type">回收数量</th>
						<th class="table-type">持有数量</th>
						<th class="table-type">操作</th>
					</tr>
				</thead>
				<tbody>
					#{if safes!=null} #{set count:1/} #{list
					items:safes.data,as:'bean'}
					<tr>
						<td>${count}</td>
						<td>${bean?.cutter_specs}</td>
						<td>${bean?.supp_name}</td>
						<td>#{if bean?.now_num>=bean?.safe_num} <span
							style="color: green">${bean?.now_num}</span> #{/if} #{else} <span
							style="color: red">${bean?.now_num}</span> #{/else}
						</td>
						<td>${bean?.safe_num}</td>
						<td>${bean?.use_num}</td>
						<td>${bean?.rec_num}</td>
						<td>${bean?.use_num - bean?.rec_num}</td>
						<td>	<button onclick="goUrl('@{terminal.TermialInventoryAction.CutterUseDetail}?material_id=${bean?.material_id}&date=${date}')"
															class="am-btn am-btn-default am-btn-xs am-text-secondary">
															<span class="am-icon-pencil-square-o"></span> 查看详情
									</button>
						</td>
					</tr>
					#{set count:count+1/} #{/list} #{/if}
				</tbody>
			</table>
		</div>
	</div>

</div>
<!-- content end -->